home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue31 / cwdemo / CWDEMO.ZIP / CWUNIT1.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-11-01  |  16.9 KB  |  590 lines

  1. unit Cwunit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, CWTools, CWCal, TabNotBk,
  8.   Mask, Spin;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     TabbedNotebook1: TTabbedNotebook;
  13.     CWCalendar1: TCWCalendar;
  14.     CWDateLabel1: TCWDateLabel;
  15.     BitBtn1: TBitBtn;
  16.     BitBtn2: TBitBtn;
  17.     BitBtn3: TBitBtn;
  18.     BitBtn4: TBitBtn;
  19.     BitBtn5: TBitBtn;
  20.     BitBtn6: TBitBtn;
  21.     Bevel1: TBevel;
  22.     CheckBox1: TCheckBox;
  23.     CheckBox2: TCheckBox;
  24.     CheckBox3: TCheckBox;
  25.     ComboBox1: TComboBox;
  26.     Label1: TLabel;
  27.     ComboBox2: TComboBox;
  28.     Label2: TLabel;
  29.     ColorDialog1: TColorDialog;
  30.     FontDialog1: TFontDialog;
  31.     Bevel2: TBevel;
  32.     BitBtn7: TBitBtn;
  33.     BitBtn8: TBitBtn;
  34.     Label3: TLabel;
  35.     Bevel3: TBevel;
  36.     Label4: TLabel;
  37.     ComboBox3: TComboBox;
  38.     Label6: TLabel;
  39.     SpinEdit1: TSpinEdit;
  40.     GroupBox1: TGroupBox;
  41.     RadioButton1: TRadioButton;
  42.     RadioButton2: TRadioButton;
  43.     RadioButton3: TRadioButton;
  44.     BitBtn9: TBitBtn;
  45.     Label7: TLabel;
  46.     Memo1: TMemo;
  47.     BitBtn10: TBitBtn;
  48.     CWCalendar2: TCWCalendar;
  49.     Bevel4: TBevel;
  50.     Bevel5: TBevel;
  51.     Bevel6: TBevel;
  52.     CWDateLabel2: TCWDateLabel;
  53.     CWNavBtn1: TCWNavBtn;
  54.     CWNavBtn2: TCWNavBtn;
  55.     CWNavBtn3: TCWNavBtn;
  56.     CWNavBtn4: TCWNavBtn;
  57.     CWNavBtn5: TCWNavBtn;
  58.     CWDateLabel3: TCWDateLabel;
  59.     CWMonthCombo1: TCWMonthCombo;
  60.     CWYearCombo1: TCWYearCombo;
  61.     BitBtn11: TBitBtn;
  62.     CWDateEdit1: TCWDateEdit;
  63.     Label8: TLabel;
  64.     Label9: TLabel;
  65.     Label10: TLabel;
  66.     Label11: TLabel;
  67.     CWDateSpin1: TCWDateSpin;
  68.     CWDateSpin2: TCWDateSpin;
  69.     CWDateSpin3: TCWDateSpin;
  70.     CWArrowBtn1: TCWArrowBtn;
  71.     CWArrowBtn2: TCWArrowBtn;
  72.     CWArrowBtn3: TCWArrowBtn;
  73.     CWArrowBtn4: TCWArrowBtn;
  74.     CWArrowBtn5: TCWArrowBtn;
  75.     CWArrowBtn6: TCWArrowBtn;
  76.     Label12: TLabel;
  77.     Label13: TLabel;
  78.     Label14: TLabel;
  79.     CWDropDownEdit1: TCWDropDownEdit;
  80.     CWCalendar3: TCWCalendar;
  81.     ListBox1: TListBox;
  82.     ListBox2: TListBox;
  83.     CWNavBtn6: TCWNavBtn;
  84.     CWNavBtn7: TCWNavBtn;
  85.     Edit1: TEdit;
  86.     CheckBox4: TCheckBox;
  87.     BitBtn12: TBitBtn;
  88.     CWDateLabel4: TCWDateLabel;
  89.     Bevel7: TBevel;
  90.     Label15: TLabel;
  91.     Label16: TLabel;
  92.     BitBtn13: TBitBtn;
  93.     CWCalendar4: TCWCalendar;
  94.     Label17: TLabel;
  95.     Label18: TLabel;
  96.     Label19: TLabel;
  97.     Label20: TLabel;
  98.     Label21: TLabel;
  99.     Label22: TLabel;
  100.     Label23: TLabel;
  101.     Shape1: TShape;
  102.     Bevel8: TBevel;
  103.     CWDateLabel5: TCWDateLabel;
  104.     CWArrowBtn7: TCWArrowBtn;
  105.     CWArrowBtn8: TCWArrowBtn;
  106.     CWArrowBtn9: TCWArrowBtn;
  107.     CWArrowBtn10: TCWArrowBtn;
  108.     Label24: TLabel;
  109.     Label25: TLabel;
  110.     Label26: TLabel;
  111.     Label27: TLabel;
  112.     Bevel9: TBevel;
  113.     Bevel10: TBevel;
  114.     Memo2: TMemo;
  115.     Bevel11: TBevel;
  116.     BitBtn14: TBitBtn;
  117.     CWQuickCalendar1: TCWQuickCalendar;
  118.     Button1: TButton;
  119.     Label28: TLabel;
  120.     Label29: TLabel;
  121.     Label30: TLabel;
  122.     Label31: TLabel;
  123.     Label32: TLabel;
  124.     Label33: TLabel;
  125.     Label34: TLabel;
  126.     Label35: TLabel;
  127.     Label36: TLabel;
  128.     Label37: TLabel;
  129.     Label38: TLabel;
  130.     Label39: TLabel;
  131.     Label40: TLabel;
  132.     Label41: TLabel;
  133.     Label42: TLabel;
  134.     Label43: TLabel;
  135.     Label44: TLabel;
  136.     Label45: TLabel;
  137.     Label46: TLabel;
  138.     Label47: TLabel;
  139.     Label48: TLabel;
  140.     Label49: TLabel;
  141.     Label50: TLabel;
  142.     Memo3: TMemo;
  143.     Label51: TLabel;
  144.     Label52: TLabel;
  145.     Memo4: TMemo;
  146.     BitBtn15: TBitBtn;
  147.     Button2: TButton;
  148.     Memo5: TMemo;
  149.     Memo6: TMemo;
  150.     Memo7: TMemo;
  151.     Bevel12: TBevel;
  152.     procedure CheckBox1Click(Sender: TObject);
  153.     procedure CheckBox2Click(Sender: TObject);
  154.     procedure CheckBox3Click(Sender: TObject);
  155.     procedure ComboBox1Change(Sender: TObject);
  156.     procedure FormShow(Sender: TObject);
  157.     procedure ComboBox2Change(Sender: TObject);
  158.     procedure BitBtn1Click(Sender: TObject);
  159.     procedure CWCalendar1DateChange(Sender: TObject);
  160.     procedure BitBtn4Click(Sender: TObject);
  161.     procedure BitBtn5Click(Sender: TObject);
  162.     procedure BitBtn3Click(Sender: TObject);
  163.     procedure BitBtn2Click(Sender: TObject);
  164.     procedure BitBtn6Click(Sender: TObject);
  165.     procedure BitBtn7Click(Sender: TObject);
  166.     procedure BitBtn8Click(Sender: TObject);
  167.     procedure ComboBox3Change(Sender: TObject);
  168.     procedure SpinEdit1Change(Sender: TObject);
  169.     procedure RadioButton3Click(Sender: TObject);
  170.     procedure RadioButton1Click(Sender: TObject);
  171.     procedure RadioButton2Click(Sender: TObject);
  172.     procedure BitBtn10Click(Sender: TObject);
  173.     procedure CWCalendar2DateChange(Sender: TObject);
  174.     procedure CWCalendar3Update(Sender: TObject);
  175.     procedure CWCalendar3DragOver(Sender, Source: TObject; X, Y: Integer;
  176.       State: TDragState; var Accept: Boolean);
  177.     procedure CWCalendar3DragDrop(Sender, Source: TObject; X, Y: Integer);
  178.     procedure Edit1DragOver(Sender, Source: TObject; X, Y: Integer;
  179.       State: TDragState; var Accept: Boolean);
  180.     procedure Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
  181.     procedure CheckBox4Click(Sender: TObject);
  182.     procedure CWCalendar3MouseDown(Sender: TObject; Button: TMouseButton;
  183.       Shift: TShiftState; X, Y: Integer);
  184.     procedure CWCalendar3DateChange(Sender: TObject);
  185.     procedure CWCalendar4DateChange(Sender: TObject);
  186.     procedure CWCalendar4RangeChange(Sender: TObject);
  187.     procedure CWCalendar4MouseUp(Sender: TObject; Button: TMouseButton;
  188.       Shift: TShiftState; X, Y: Integer);
  189.     procedure CWNavBtn8Click(Sender: TObject);
  190.     procedure CWArrowBtn10Click(Sender: TObject);
  191.     procedure CWArrowBtn9Click(Sender: TObject);
  192.     procedure CWCalendar4KeyUp(Sender: TObject; var Key: Word;
  193.       Shift: TShiftState);
  194.     procedure Button1Click(Sender: TObject);
  195.     procedure CWDropDownEdit1Change(Sender: TObject);
  196.     procedure Button2Click(Sender: TObject);
  197.   private
  198.     { Private declarations }
  199.   public
  200.     { Public declarations }
  201.   end;
  202.  
  203. var
  204.   Form1: TForm1;
  205.   SelectedDay : integer;
  206.   LastEditDate : TDateTime;
  207.  
  208. implementation
  209.  
  210. {$R *.DFM}
  211.  
  212. procedure TForm1.CheckBox1Click(Sender: TObject);
  213. begin
  214.   CWCalendar1.Ctl3D := not CWCalendar1.Ctl3D;
  215. end;
  216.  
  217. procedure TForm1.CheckBox2Click(Sender: TObject);
  218. begin
  219.   CWCalendar1.GridLines := not CWCalendar1.GridLines;
  220. end;
  221.  
  222. procedure TForm1.CheckBox3Click(Sender: TObject);
  223. begin
  224.   CWCalendar1.ShowDayTitles := not CWCalendar1.ShowDayTitles;
  225. end;
  226.  
  227. procedure TForm1.ComboBox1Change(Sender: TObject);
  228. begin
  229.   case ComboBox1.ItemIndex of
  230.      0: CWCalendar1.DatePosition := Centered;
  231.      1: CWCalendar1.DatePosition := UpperLeft;
  232.      2: CWCalendar1.DatePosition := UpperRight;
  233.      3: CWCalendar1.DatePosition := LowerLeft;
  234.      4: CWCalendar1.DatePosition := LowerRight;
  235.   end;
  236. end;
  237.  
  238. procedure TForm1.FormShow(Sender: TObject);
  239. begin
  240.   ComboBox1.ItemIndex := 0;
  241.   ComboBox2.ItemIndex := 0;
  242.   ComboBox3.ItemIndex := 0;
  243.   Label26.Caption := DateToStr(Date);
  244.   Label27.Caption := DateToStr(Date);
  245.   CWDropDownEdit1.Text := DateToStr(Date);
  246. end;
  247.  
  248. procedure TForm1.ComboBox2Change(Sender: TObject);
  249. begin
  250.   case ComboBox2.ItemIndex of
  251.      0: CWCalendar1.DayTitleFormat := OneLetter;
  252.      1: CWCalendar1.DayTitleFormat := TwoLetters;
  253.      2: CWCalendar1.DayTitleFormat := ThreeLetters;
  254.      3: begin
  255.         MessageDlg('Header font may have to be changed!', mtWarning, [mbOK],0);
  256.         CWCalendar1.DayTitleFormat := FullName;
  257.         end;
  258.   end;
  259. end;
  260.  
  261. procedure TForm1.BitBtn1Click(Sender: TObject);
  262. begin
  263.   if ColorDialog1.Execute then
  264.      begin
  265.      CWCalendar1.BlockColor := ColorDialog1.Color;
  266.      CWCalendar1.CellColor := ColorDialog1.Color;
  267.      end;
  268. end;
  269.  
  270. procedure TForm1.CWCalendar1DateChange(Sender: TObject);
  271. begin
  272.   CWDateLabel1.SetDate;
  273. end;
  274.  
  275. procedure TForm1.BitBtn4Click(Sender: TObject);
  276. begin
  277.   FontDialog1.Font.Assign(CWCalendar1.HeaderFont);
  278.   if FontDialog1.Execute then
  279.      CWCalendar1.HeaderFont.Assign(FontDialog1.Font);
  280. end;
  281.  
  282. procedure TForm1.BitBtn5Click(Sender: TObject);
  283. begin
  284.   FontDialog1.Font.Assign(CWCalendar1.DateFont);
  285.   if FontDialog1.Execute then
  286.      CWCalendar1.DateFont.Assign(FontDialog1.Font);
  287. end;
  288.  
  289. procedure TForm1.BitBtn3Click(Sender: TObject);
  290. begin
  291.   ColorDialog1.Color := CWCalendar1.GridColor;
  292.   if ColorDialog1.Execute then
  293.      CWCalendar1.GridColor := ColorDialog1.Color;
  294. end;
  295.  
  296. procedure TForm1.BitBtn2Click(Sender: TObject);
  297. begin
  298.   ColorDialog1.Color := CWCalendar1.HeaderColor;
  299.   if ColorDialog1.Execute then
  300.      CWCalendar1.HeaderColor := ColorDialog1.Color;
  301. end;
  302.  
  303. procedure TForm1.BitBtn6Click(Sender: TObject);
  304. begin
  305.   ColorDialog1.Color := CWCalendar1.HiLightColor;
  306.   if ColorDialog1.Execute then
  307.      CWCalendar1.HiLightColor := ColorDialog1.Color;
  308. end;
  309.  
  310. procedure TForm1.BitBtn7Click(Sender: TObject);
  311. begin
  312.   ColorDialog1.Color := CWCalendar1.SundayColor;
  313.   if ColorDialog1.Execute then
  314.      CWCalendar1.SundayColor := ColorDialog1.Color;
  315. end;
  316.  
  317. procedure TForm1.BitBtn8Click(Sender: TObject);
  318. begin
  319.   ColorDialog1.Color := CWCalendar1.TodayColor;
  320.   if ColorDialog1.Execute then
  321.      CWCalendar1.TodayColor := ColorDialog1.Color;
  322. end;
  323.  
  324. procedure TForm1.ComboBox3Change(Sender: TObject);
  325. begin
  326.   case ComboBox3.ItemIndex of
  327.      0: CWCalendar1.StartOfWeek := Sunday;
  328.      1: CWCalendar1.StartOfWeek := Monday;
  329.      2: CWCalendar1.StartOfWeek := Tuesday;
  330.      3: CWCalendar1.StartOfWeek := Wednesday;
  331.      4: CWCalendar1.StartOfWeek := Thursday;
  332.      5: CWCalendar1.StartOfWeek := Friday;
  333.      6: CWCalendar1.StartOfWeek := Saturday;
  334.   end;
  335. end;
  336.  
  337. procedure TForm1.SpinEdit1Change(Sender: TObject);
  338. begin
  339.   if SpinEdit1.Text = '' then exit;
  340.   if SpinEdit1.Value < 1 then SpinEdit1.Value := 1;
  341.   if SpinEdit1.Value > 100 then SpinEdit1.Value := 100;
  342.   CWCalendar1.HeaderHeight := SpinEdit1.Value;
  343. end;
  344.  
  345. procedure TForm1.RadioButton3Click(Sender: TObject);
  346. begin
  347.   CWCalendar1.HiLight3D := hlNone;
  348. end;
  349.  
  350. procedure TForm1.RadioButton1Click(Sender: TObject);
  351. begin
  352.     CWCalendar1.HiLight3D := hlRaised;
  353. end;
  354.  
  355. procedure TForm1.RadioButton2Click(Sender: TObject);
  356. begin
  357.     CWCalendar1.HiLight3D := hlLowered;
  358. end;
  359.  
  360. procedure TForm1.BitBtn10Click(Sender: TObject);
  361. begin
  362.   if BitBtn10.Caption = 'Change Day Titles' then
  363.      begin
  364.      Memo1.Visible := true;
  365.      BitBtn10.Caption := 'Apply Titles'
  366.      end
  367.   else
  368.      begin
  369.      if Memo1.Lines.Count < 6 then
  370.         begin
  371.         MessageDlg('Must have seven day titles!', mtError, [mbOK],0);
  372.         Memo1.SetFocus;
  373.         exit;
  374.         end;
  375.      Memo1.Visible := false;
  376.      BitBtn10.Caption := 'Change Day Titles';
  377.      CWCalendar1.DayTitles.Assign(Memo1.Lines);
  378.      end;
  379. end;
  380.  
  381. procedure TForm1.CWCalendar2DateChange(Sender: TObject);
  382. begin
  383.   CWDateLabel2.SetDate;
  384.   CWDateLabel3.SetDate;
  385.   CWMonthCombo1.SetDate;
  386.   CWYearCombo1.SetDate;
  387.   CWDateEdit1.SetDate;
  388. end;
  389.  
  390. procedure TForm1.CWCalendar3Update(Sender: TObject);
  391. begin
  392.   CWCalendar3.AddText(Date,clRed,'Fire Someone!');
  393.   CWCalendar3.AddText(Date + 2, clBlue, 'Phone George');
  394.   CWCalendar3.AddText(Date + 2, clBlack, 'Get E-mail');
  395.   CWCalendar3.AddText(Date + 8, clGreen, 'Buy Calendar-');
  396.   CWCalendar3.AddText(Date + 8, clGreen, 'Works');
  397.   CWCalendar3.AddText(Date - 3, clMaroon,'Meeting');
  398.  
  399.   CWCalendar3.AddBitmap(Date,'CWCheck');
  400.   CWCalendar3.AddBitmap(Date + 2, 'CWPhone');
  401.   CWCalendar3.AddBitmap(Date + 8, 'CWToDo');
  402.   CWCalendar3.AddBitmap(Date - 3, 'CWAlarm');
  403. end;
  404.  
  405. procedure TForm1.CWCalendar3DragOver(Sender, Source: TObject; X,
  406.   Y: Integer; State: TDragState; var Accept: Boolean);
  407. begin
  408. if Source is TListBox then
  409.     Accept := True;
  410. end;
  411.  
  412. procedure TForm1.CWCalendar3DragDrop(Sender, Source: TObject; X,
  413.   Y: Integer);
  414. var ABitMap: array[0..12] of char;
  415.     AColor : TColor;
  416. begin
  417. SelectedDay := CWCalendar3.GetDayXY(X,Y);
  418. if (Source = ListBox1) or (Source = ListBox2) then
  419.   begin
  420.   if SelectedDay <> 0 then
  421.      begin
  422.      with CWCalendar3 do
  423.         begin
  424.         if Source = ListBox1 then
  425.            begin
  426.            case ListBox1.ItemIndex of
  427.               0: AColor := clGreen;
  428.               1: AColor := clBlue;
  429.               2: AColor := clRed;
  430.               3: AColor := clBlack;
  431.            end;
  432.            AddText(EncodeDate(Year,Month,SelectedDay),AColor,ListBox1.Items[ListBox1.ItemIndex])
  433.            end
  434.         else
  435.            begin
  436.            case ListBox2.ItemIndex of
  437.               0: StrPCopy(ABitMap,'CWALARM');
  438.               1: StrPCopy(ABitMap,'CWBULBON');
  439.               2: StrPCopy(ABitMap,'CWCHECK');
  440.               3: StrPCopy(ABitMap,'CWGLOBE');
  441.               4: StrPCopy(ABitMap,'CWLIBRARY');
  442.               5: StrPCopy(ABitMap,'CWMAILBOX');
  443.               6: StrPCopy(ABitMap,'CWNIGHT');
  444.               7: StrPCopy(ABitMap,'CWPENCIL');
  445.               8: StrPCopy(ABitMap,'CWPHONE');
  446.               9: StrPCopy(ABitMap,'CWTODO');
  447.            end;
  448.            AddBitmap(EncodeDate(Year,Month,SelectedDay),ABitMap);
  449.            end;
  450.         end;
  451.      end;
  452.   CWCalendar3.RefreshDay(SelectedDay);
  453.   end;
  454. end;
  455.  
  456. procedure TForm1.Edit1DragOver(Sender, Source: TObject; X, Y: Integer;
  457.   State: TDragState; var Accept: Boolean);
  458. begin
  459.   if Source = CWCalendar3 then
  460.      Accept := true;
  461. end;
  462.  
  463. procedure TForm1.Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
  464. begin
  465.   if SelectedDay = 0 then exit;
  466.   if Source = CWCalendar3 then
  467.      begin
  468.      with CWCalendar3 do
  469.      Edit1.Text := FormatDateTime('mmmm d, yyyy', EncodeDate(Year,Month,SelectedDay));
  470.      end;
  471. end;
  472.  
  473. procedure TForm1.CheckBox4Click(Sender: TObject);
  474. begin
  475.   if CheckBox4.Checked then CWCalendar3.DragDate := true
  476.   else CWCalendar3.DragDate := false;
  477. end;
  478.  
  479. procedure TForm1.CWCalendar3MouseDown(Sender: TObject;
  480.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  481. begin
  482.   if CWCalendar3.DragDate then
  483.      SelectedDay := CWCalendar3.GetDayXY(X,Y);
  484. end;
  485.  
  486. procedure TForm1.CWCalendar3DateChange(Sender: TObject);
  487. begin
  488.   CWDateLabel4.SetDate;
  489. end;
  490.  
  491. procedure TForm1.CWCalendar4DateChange(Sender: TObject);
  492. begin
  493.   CWDateLabel5.SetDate;
  494.   Label26.Caption := DateToStr(CWCalendar4.RangeStartDate);
  495.   Label27.Caption := DateToStr(CWCalendar4.RangeEndDate);
  496. end;
  497.  
  498. procedure TForm1.CWCalendar4RangeChange(Sender: TObject);
  499. begin
  500.   CWDateLabel5.SetDate;
  501. end;
  502.  
  503. procedure TForm1.CWCalendar4MouseUp(Sender: TObject; Button: TMouseButton;
  504.   Shift: TShiftState; X, Y: Integer);
  505. begin
  506.   Label26.Caption := DateToStr(CWCalendar4.RangeStartDate);
  507.   Label27.Caption := DateToStr(CWCalendar4.RangeEndDate);
  508. end;
  509.  
  510. procedure TForm1.CWNavBtn8Click(Sender: TObject);
  511. begin
  512.   CWCalendar4.ResetRange;
  513. end;
  514.  
  515. procedure TForm1.CWArrowBtn10Click(Sender: TObject);
  516. begin
  517.   CWCalendar4.ResetRange;
  518. end;
  519.  
  520. procedure TForm1.CWArrowBtn9Click(Sender: TObject);
  521. begin
  522.   CWCalendar4.ResetRange;
  523. end;
  524.  
  525. procedure TForm1.CWCalendar4KeyUp(Sender: TObject; var Key: Word;
  526.   Shift: TShiftState);
  527. begin
  528.   if Key in [VK_PRIOR, VK_NEXT, VK_LEFT,VK_UP, VK_RIGHT, VK_DOWN] then
  529.      begin
  530.      Label26.Caption := DateToStr(CWCalendar4.RangeStartDate);
  531.      Label27.Caption := DateToStr(CWCalendar4.RangeEndDate);
  532.      end;
  533. end;
  534.  
  535. procedure TForm1.Button1Click(Sender: TObject);
  536. begin
  537.   CWQuickCalendar1.Execute;
  538.   Button1.Caption := CWQuickCalendar1.DisplayDate;
  539. end;
  540.  
  541. procedure TForm1.CWDropDownEdit1Change(Sender: TObject);
  542. var TheYear, TheMonth, TheDay : word;
  543.     ADay : array [1..7] of string;
  544. begin
  545.   ADay[1] := 'Sunday';
  546.   ADay[2] := 'Monday';
  547.   ADay[3] := 'Tuesday';
  548.   ADay[4] := 'Wednesday';
  549.   ADay[5] := 'Thursday';
  550.   ADay[6] := 'Friday';
  551.   ADay[7] := 'Saturday';
  552.  
  553.   if LastEditDate = 0 then LastEditDate := Date;
  554.   DecodeDate(CWDropDownEdit1.EditDate,TheYear,TheMonth,TheDay);
  555.   with CWCalendar1 do
  556.      begin
  557.      Label40.Caption := IntToStr(DayNumber(CWDropDownEdit1.EditDate));
  558.      Label41.Caption := IntToStr(DaysRemaining(0,CWDropDownEdit1.EditDate));
  559.      Label42.Caption := IntToStr(DaysRemaining(1,CWDropDownEdit1.EditDate));
  560.      Label43.Caption := IntToStr(DaysInYear(TheYear));
  561.      Label44.Caption := IntToStr(DaysInMonth(TheYear,TheMonth));
  562.      Label45.Caption := IntToStr(DaysBetween(LastEditDate,CWDropDownEdit1.EditDate));
  563.      Label46.Caption := ADay[FirstOfMonth(TheYear,TheMonth)];
  564.      Label47.Caption := ADay[WeekDay(CWDropDownEdit1.EditDate)];
  565.      Label48.Caption := IntToStr(WeekNumber(CWDropDownEdit1.EditDate));
  566.      if IsLeapYear(TheYear) then
  567.         Label49.Caption := 'Yes'
  568.      else Label49.Caption := 'No';
  569.      LastEditDate := CWDropDownEdit1.EditDate;
  570.      end;
  571. end;
  572.  
  573. procedure TForm1.Button2Click(Sender: TObject);
  574. begin
  575.   if Memo4.Visible = false then
  576.      begin
  577.      Memo4.Visible := true;
  578.      Label51.Caption := 'Registering Your Copy of CalendarWorks';
  579.      Button2.Caption := 'Registering with a Credit Card';
  580.      end
  581.   else
  582.      begin
  583.      Memo4.Visible := false;
  584.      Label51.Caption := 'Credit Card Registration';
  585.      Button2.Caption := 'Registering CalendarWorks';
  586.      end;
  587. end;
  588.  
  589. end.
  590.